﻿@using YYBlog.Core.Extensions
@inherits Nancy.ViewEngines.Razor.NancyRazorViewBase<YYBlog.Core.ViewProjections.Home.RecentBlogPostsViewModel>
@{ Layout = "_Layout.cshtml"; }
@foreach (var blogPost in Model.Posts)
{
    <article class="post">
        <header class="post-title"><a href="@blogPost.GetLink()">@blogPost.Title</a></header>
        <section class="post-meta">
            <ul class="list-inline d-inline">
                @if (!string.IsNullOrEmpty(blogPost.Tags))
                {
                    foreach (var tag in blogPost.TagsArray)
                    {
                        <text>
                            <li class="list-inline-item"><a href="/tag/@tag">@tag.AsTag().Name</a></li>
                        </text>
                    }
                }

            </ul>
            <time class="post-date">@blogPost.PubDate.ToString("yyyy-MM-dd HH:mm")</time>
        </section>
        <footer></footer>
    </article>
}
<div class="pager text-right">
    @if (Model.HasPrevPage)
    {

        if (Model.Page == 2)
        {
            <a href="/" class="btn btn-outline-dark">下一页</a>

        }
        else
        {
            <a href="/page/@(Model.Page - 1)" class="btn btn-outline-dark">下一页</a>
        }

    }
    @if (Model.HasNextPage)
    {
        <a href="/page/@(Model.Page + 1)" class="btn btn-outline-dark">上一页</a>

    }

</div>